:root {
  --primary-color: #1890ff;
  --primary-light: #e6f7ff;
  --secondary-color: #52c41a;
  --text-primary: #333333;
  --text-secondary: #666666;
  --background-light: #f5f9ff;
  --border-color: #e8f4ff;
  --doctor-message: #1890ff;
  --patient-message: #f0f2f5;
  --success-color: #52c41a;
  --background-dark: #f0f0f0;
}

.chat-app {
  max-width: 750px;
  margin: 0 auto;
  background-color: var(--background-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.chat-header {
  background: white;
  padding: 1.2rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-header h2 {
  margin: 0;
  font-size: 1.6rem;
  color: var(--text-primary);
  position: relative;
  padding-left: 1.5rem;
}

.chat-header h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background-color: var(--primary-color);
  border-radius: 2px;
}

.chat-messages {
  flex: 1;
  padding: 1.5rem 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.message {
  display: flex;
  margin-bottom: 1rem;
}

.message.doctor {
  justify-content: flex-end;
}

.message-content {
  position: relative;
  max-width: 80%;
  padding: 10px 15px;
  border-radius: 15px;
  word-wrap: break-word;
}

.message.doctor .message-content {
  background-color: var(--doctor-message);
  margin-left: auto;
  border-bottom-right-radius: 5px;
}

.message.patient .message-content {
  background-color: var(--patient-message);
  margin-right: auto;
  border-bottom-left-radius: 5px;
}

.message-content p {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.5;
}

.chat-input {
  background: white;
  padding: 1.2rem;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.chat-input input {
  flex: 1;
  padding: 1rem 1.5rem;
  border: 2px solid var(--border-color);
  border-radius: 2rem;
  font-size: 1.4rem;
  outline: none;
  transition: all 0.3s ease;
}

.chat-input input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.chat-input button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 2rem;
  font-size: 1.4rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(24, 144, 255, 0.2);
}

.chat-input button:hover {
  background-color: #40a9ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(24, 144, 255, 0.3);
}

.chat-input button:active {
  transform: translateY(0);
}

/* 消息时间样式 */
.message-time {
  font-size: 1.2rem;
  color: #999;
  margin: 0.5rem 0;
  text-align: center;
}

/* 消息状态指示器 */
.message-status {
  font-size: 12px;
  color: #888;
  margin-top: 4px;
  text-align: right;
}

.doctor .message-status {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.status-icon {
  color: var(--primary-color);
  font-size: 14px;
}

/* 输入框占位符样式 */
.chat-input input::placeholder {
  color: #999;
}

/* 响应式优化 */
@media screen and (max-width: 480px) {
  .chat-header h2 {
    font-size: 1.4rem;
  }

  .message-content p {
    font-size: 1.3rem;
  }

  .chat-input {
    padding: 1rem;
  }

  .chat-input input {
    padding: 0.8rem 1.2rem;
    font-size: 1.3rem;
  }

  .chat-input button {
    padding: 0.8rem 1.5rem;
    font-size: 1.3rem;
  }

  .message-content {
    max-width: 85%;
  }
}

/* 滚动条美化 */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
  background: var(--background-light);
}

.chat-messages::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background-color: #999;
}

.connection-status {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 12px;
  margin-left: 10px;
}

.connection-status.connected {
  background-color: var(--success-color);
  color: white;
}

.connection-status.disconnected {
  background-color: var(--text-secondary);
  color: white;
}

.chat-input input:disabled {
  background-color: var(--background-dark);
  cursor: not-allowed;
}

.chat-input button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}